package homework.test8;

import java.util.TreeSet;

/*
TreeSet类存储Student对象并遍历
  提示步骤:
	1.Student类实现 Comparable<Student>接口
    2.重写 public int compareTo(Student o) 方法  制定排序规则
 */
public class Demo8 {
    public static void main(String[] args) {
        TreeSet<Student> ts = new TreeSet<>();

        Student s1 = new Student("小花",27);
        Student s2 = new Student("小小花",28);
        Student s3 = new Student("小花花",26);

        ts.add(s1);
        ts.add(s2);
        ts.add(s3);

        System.out.println(ts);
    }
}
